import { CopyInfoPanelBase } from "../CopyInfoPanelBase";
import { Language } from "../../../../../extend/language/Language";
import { ObjCreate } from "../../common/ObjCreate";
import { AutoLayoutTextContainer } from "../../../../common/text/AutoLayoutTextContainer";
import { DisplayUtil } from "../../../../common/DisplayUtil";
import { SEatBeansInfo } from "../../../../../Message/Public/SEatBeansInfo";
import { Cache } from "../../../cache/Cache";
import { EatBeansSmallMap } from "./EatBeansSmallMap";
import { SecTimerView } from "../../common/SecTimerView";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
type int = number;
//class EatBeansInfoPanel
    
    export  class EatBeansInfoPanel extends CopyInfoPanelBase
    {
        constructor(arg1: string="EatBeansInfoV")
        {
            super(arg1);
            this.title = Language.getString(80385);
            this.mouseEnabled = false;
            return;
        }

        protected /* override */ createChildren(): void
        {
            var loc1=null;
            super.createChildren();
            this._txtSearching = ObjCreate.createGTextField("", 25, 2, 220, 20, _bodySp);
            loc1 = this._txtSearching.defaultTextFormat;
            loc1.color = 16711680;
            loc1.size = 13;
            this._txtSearching.defaultTextFormat = loc1;
            this._txtSearching.text = Language.getString(80386);
            this._leftTimer = ObjCreate.createSecTimeView(Language.getString(80365), 25, 2, 200, 20, _bodySp);
            loc1 = this._leftTimer.defaultTextFormat;
            loc1.size = 13;
            this._leftTimer.defaultTextFormat = loc1;
            this._container = new AutoLayoutTextContainer();
            this._container.x = 25;
            this._container.y = 20;
            this._container.verticalGap = -3;
            this._container.layoutByVisible = true;
            _bodySp.addChild(this._container);
            this._container.addNewText(220, "", 12);
            this._container.addNewText(220, "", 12);
            this._container.addNewText(220, "", 12);
            this._container.addNewText(220, "", 12);
            this._container.addNewText(220, "", 12);
            this._container.addNewText(237, "", 12);
            return;
        }

        public setLeftTime(arg1: int): void
        {
            if (this._leftTimer == null) 
            {
                return;
            }
            _bodySp.addChild(this._leftTimer);
            this._leftTimer.setLeftTime(arg1);
            return;
        }

        public set searchingStatus(arg1: Boolean)
        {
            if (arg1) 
            {
                _bodySp.addChild(this._txtSearching);
                this._txtSearching.text = Language.getString(80386);
                DisplayUtil.removeMe(this._leftTimer);
            }
            else 
            {
                DisplayUtil.removeMe(this._txtSearching);
            }
            return;
        }

        public setEnd(): void
        {
            _bodySp.addChild(this._txtSearching);
            this._txtSearching.text = Language.getString(80387);
            if (this._leftTimer) 
            {
                this._leftTimer.stop();
                DisplayUtil.removeMe(this._leftTimer);
            }
            return;
        }

        public reInit(): void
        {
            var loc1=0;
            this._container.getTextByIndex(1).visible = true;
            this._container.setText(loc1++, "  " + Language.getStringByParam(80394, 0));
            this._container.setText(loc1++, "  " + Language.getStringByParam(80366, 0));
            this._container.setText(loc1++, "  " + Language.getStringByParam(80367, 100));
            this._container.setText(loc1++, "  " + Language.getStringByParam(80368, 0));
            this._container.setText(loc1++, "  " + Language.getStringByParam(80369, 0));
            this._container.setText(loc1++, Language.getString(80392));
            return;
        }

        public updateInfo(arg1: SEatBeansInfo): void
        {
            if (arg1 == null) 
            {
                return;
            }
            if (Cache.instance.eatBeans.getRoleID(Cache.instance.role.entityInfo.entityId) != EatBeansSmallMap.DefenderID) 
            {
                this._container.getTextByIndex(1).visible = true;
            }
            else 
            {
                this._container.getTextByIndex(1).visible = false;
            }
            var loc1=0;
            this._container.setText(loc1++, "  " + Language.getStringByParam(80394, arg1.kill));
            this._container.setText(loc1++, "  " + Language.getStringByParam(80366, arg1.eatBeans));
            this._container.setText(loc1++, "  " + Language.getStringByParam(80367, arg1.defenseMan));
            this._container.setText(loc1++, "  " + Language.getStringByParam(80368, arg1.eatingMan));
            this._container.setText(loc1++, "  " + Language.getStringByParam(80369, arg1.beansRemain));
            this._container.setText(loc1++, Language.getString(80392));
            return;
        }

        /* internal */ /* var */_leftTimer: SecTimerView;

        /* internal */ /* var */_txtSearching: GTextFiled;

        /* internal */ /* var */_container: AutoLayoutTextContainer;
    }
